//
//  LOLFreeheroCell.m
//  LOLXXbox
//
//  Created by mac on 16/1/28.
//  Copyright © 2016年 Grasstrio. All rights reserved.
//

#import "LOLFreeheroCell.h"
#import <UIImageView+WebCache.h>
#import "LOLFreeHeroViewController.h"
#import <Masonry.h>
@implementation LOLFreeheroCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _heroImage = [[UIImageView alloc] initWithFrame:CGRectZero];
        _heroName = [[UILabel alloc] initWithFrame:CGRectZero];
        _heroName.font = [UIFont systemFontOfSize:15];
        _heroSmallname = [[UILabel alloc] initWithFrame:CGRectZero];
        _heroSmallname.font = [UIFont systemFontOfSize:13];
        _heroSmallname.textColor = [UIColor lightGrayColor];
        _type = [[UILabel alloc] initWithFrame:CGRectZero];
        _type.font = [UIFont systemFontOfSize:14];
        _type.textColor = [UIColor blueColor];
        [self.contentView addSubview:_heroImage];
        [self.contentView addSubview:_heroName];
        [self.contentView addSubview:_heroSmallname];
        [self.contentView addSubview:_type];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [_heroImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.mas_equalTo(CGSizeMake(60, 60));
    }];
    _heroName.frame = CGRectMake(_heroImage.frame.size.width + 3, 0, 100, 15);
    _heroSmallname.frame = CGRectMake(_heroImage.frame.size.width + 3, _heroName.frame.size.height + 10, 80, 15);
    _type.frame = CGRectMake(_heroImage.frame.size.width + 3, _heroSmallname.frame.size.height + _heroName.frame.size.height + 15, 130, 15);
}

- (void)setModel:(LOLHeroModel *)model {
    _model = model;
    _headimage = [NSString stringWithFormat:@"http://img.lolbox.duowan.com/champions/%@_120x120.jpg",_model.enName];
    [_heroImage sd_setImageWithURL:[NSURL URLWithString:_headimage]];
    _heroName.text = _model.title;
    _heroSmallname.text = _model.cnName;
    _type.text = _model.location;
    
}


@end
